
//***********************************************
//
//      Filename: classwork.java
//
//        Author: wwb
//        Mails: 1274860621@qq.com
//        Create: 2018-05-13 19:25:08
// Last Modified: 2018-05-13 19:25:08
//***********************************************
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Scanner;
public class classwork {
    public static void main(String[] args) throws IOException {
        int n;
        Scanner scan =new Scanner(System.in);
        System.out.println("请输入一个数： ");
        n=scan.nextInt();
        fact(n);
        System.out.println(fact(n));
        File file = new File("D:\\test","Test1.txt");
        if (!file.exists()){
            file.createNewFile();}
        Writer writer = new FileWriter(file);
        writer.write("输入："+n+"输出以后："+String.valueOf(fact(n)) );
        writer.flush();
        }
        static int fact(int n)
        {
            int result;
            if(n==0)
                return 0;
            else if (n==1)
                return 1;
            else
                result= fact(n-1)+fact(n-2);
            return result;

        }
}

